package com.eke.dao;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.alibaba.druid.sql.ast.statement.SQLWithSubqueryClause.Entry;
import com.eke.bean.Sign_up;
import com.jason.dbhelper2.jdbc.BaseJdbcTemplate;
import com.jason.mvc.annotations.Ajax;
import com.jason.mvc.annotations.RequestMapping;

@Repository("signUpDao")
public class SignUpDao extends BaseJdbcTemplate<Sign_up> {

	/**
	 * 报名课程
	 * 
	 * @param entry
	 * @return {@link Boolean}
	 */
	public int signCourse(Sign_up sign_up) {
		return this.insert(sign_up);
	}
	
	/**
	 * 判断用户是否已报名该课程
	 * @param userId
	 * 		用户id
	 * @param courseId
	 * 		课程id
	 * @return {@link Boolean} 
	 * 		true 已报名
	 * 		false 未报名
	 */
	public boolean isSignUp(Integer userId, Integer courseId) {
		return this.queryForList("select * from sign_up where course_id = ? and user_id = ?", courseId, userId).size() > 0;
	}
	


}
